Skip to content

Support environment variable CARGO_MANIFEST_PATH. #19751

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

VictorArcium
Copy link
Contributor

CARGO_MANIFEST_PATH is an environment variable added in August 2024, pointing directly to the Cargo.toml of the current package. It was not supported by rust-analyzer. This PR aims to fix that.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 5, 2025
@ChayimFriedman2
Copy link
Contributor

Thanks!

@ChayimFriedman2 ChayimFriedman2 added this pull request to the merge queue May 5, 2025
Merged via the queue into rust-lang:master with commit d30deb5 May 5, 2025
14 checks passed
@CGMossa
Copy link

CGMossa commented May 14, 2025

How am I meant to set this environment variable in a way that affects Rust Analyzer?

@ChayimFriedman2
Copy link
Contributor

@CGMossa You don't. Cargo sets this environment variables for crates/build scripts, and rust-analyzer needs to mimic Cargo. This is what this PR was about. You use this variable e.g. in build scripts; you don't set it in any way.

@CGMossa
Copy link

CGMossa commented May 15, 2025

Thanks. I also dug into more of rust analyzer and sort realized that... Well, it doesn't work how I anticipated.

But I didn't know that rust analyzer have to mimic something.

I just wish for a way to tell rust analyzer about a nested crate without having to use linkedproject..

But no need to worry about that here. Thanks

@ChayimFriedman2
Copy link
Contributor

linkedProjects is the way. Why don't you want to use it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants